package com.lovo.pis.utils;

import com.lovo.pis.service.ICustomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component // 把此类托管给 Spring，不能省略
public class TaskUtils {

    @Autowired
    ICustomService customService;

    // 添加定时任务
    @Scheduled(cron = "0 0 12 * * ?") // cron表达式： 执行
    public void doTask() throws Exception {
       customService.sendTaskEmail();
    }
}
